﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MainSite.Master" AutoEventWireup="true" CodeBehind="pokusAjax2.aspx.cs" Inherits="BSCMFF.Web.pokusAjax2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script src="~/JS/jquery-1.6.1.js" type="text/javascript"></script>
    <%--<script src="../../JS/jquery-1.6.1.js" type="text/javascript"></script>--%>
     <div>
 <script type="text/javascript">
     $(document).ready(function () {
         $("#sayHelloButton").click(function (event) {
             $.ajax({
                 type: "POST",
                 url: "../../WebServices/SaveDataFromQuestionnaire.asmx/HelloToYou",
                 data: "{'name': '" + $('#name').val() + "'}",
                 contentType: "application/json; charset=utf-8",
                 dataType: "json",
                 success: function (msg) {
                     AjaxSucceeded(msg);
                 },
                 error: AjaxFailed
             });
         });
     });
     function AjaxSucceeded(result) {
         alert(result.d);
     }
     function AjaxFailed(result) {
         alert(result.status + ' ' + result.statusText);
     } 
 </script> 


 <h1> Calling ASP.NET AJAX Web Services with jQuery </h1>
 Enter your name:
 <input id="name" />
 <br />
 <input id="sayHelloButton" value="Say Hello"
 type="button"  />
    </div>

</asp:Content>
